<?php
namespace Fwadmin\Controller;
use Think\Controller;
class LinksController extends BaseController{
	public function index(){
		if($_GET['p']==''){
			$_GET['p'] = 1;
		}
		$viewList	= M('Links') -> where($map) -> order('id desc') -> page($_GET['p'].',15') -> select();
		$count		= M('Links') -> where($map) -> count();
		$Pages		= new \Think\Page($count, 15); 
		$Page		->url = 'page';
		$show		= $Pages -> show();
		
		$this		-> assign('pages',$show);
		$this		-> assign('viewList',$viewList);
		$this		-> display();
	}
	public function add(){

		$this				-> display('add');
	}
	public function edit(){
		$id			= I('id');
		$viewInfo	= M('Links') -> where(array('id' => $id)) -> find();

		$this		-> assign('viewInfo',$viewInfo);
		$this		-> display('edit');
	}
}